//
//  ViewController.m
//  03-HomeWork
//
//  Created by dllo on 16/7/18.
//  Copyright © 2016年 danming. All rights reserved.
//

#import "ViewController.h"
#import "Button_Label.h"
#import "Button_imageView.h"
@interface ViewController ()

@end

@implementation ViewController


//通过UILabel封装实现只显示文字的Button
//通过UIImageView封装实现只显示图片的Button 以上两种方式, 要考虑到通用性。
//使用自己封装的控件, 加入到前两天编写的登陆页中

- (void)viewDidLoad {
    [super viewDidLoad];
    [self createButton_Label];
    [self createButton_imageView];
}
#pragma mark - 实现了label封装的button
- (void)createButton_Label {
    Button_Label *button_Label = [[Button_Label alloc] initWithFrame:CGRectMake(100, 100, 150, 80) text:@"我是一个Label" target:self action:@selector(handleUp:)];
    button_Label.backgroundColor = [UIColor cyanColor];
    [self.view addSubview:button_Label];
}
#pragma mark - 实现label封装的button的点击方法
- (void)handleUp:(UITapGestureRecognizer *)tap {
    NSLog(@"点击了Label");
}

#pragma mark - 实现UIImageView封装的button
- (void)createButton_imageView {
    Button_imageView *button_image = [[Button_imageView alloc] initWithFrame:CGRectMake(100, 300, 300, 280) image:[UIImage imageNamed:@"01.jpg"] target:self action:@selector(handleImage:)];
    button_image.backgroundColor = [UIColor redColor];
    [self.view addSubview:button_image];
}
#pragma mark - 实现ImageView封装的button的点击方法
- (void)handleImage:(UITapGestureRecognizer *)tap {
    NSLog(@"点击了ImageView");
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
